package com.sixmac.platform.service.impl;

import java.util.Map;

import com.sixmac.core.base.service.BaseService;
import com.sixmac.core.plugins.dao.Md;
import com.sixmac.core.toolbox.CMap;
import com.sixmac.core.toolbox.support.Convert;
import com.sixmac.module.Tenant;
import org.springframework.stereotype.Service;
import com.sixmac.platform.service.TenantService;

/**
 * TenantServiceImpl
 * 2018-09-11 20:12:57
 * @author Blade
 */
@Service
public class TenantServiceImpl extends BaseService<Tenant> implements TenantService {

	@Override
	public boolean updateStatus(String ids, Integer status) {
		CMap map = CMap.init().set("status", status).set("ids", Convert.toIntArray(ids));
		boolean temp = updateBy("status = #{status}", "id in (#{join(ids)})", map);
		return temp;
	}

	@Override
	@SuppressWarnings("unchecked")
	public Map<String, Object> findOne(Object id) {
		return Md.selectOne("tenant.findOne", CMap.init().set("id", id), Map.class);
	}

}
